package chapter8.extend_.exercise;

public class Ex03 {
    public static void main(String[] args) {
        PC pc = new PC("intel","10G","1T","alien");
        NotePad notePad = new NotePad("amd","1G","10G","red");
        System.out.println(pc.getDetail()+""+pc.getBrand());
        System.out.println(notePad.getDetail()+" "+notePad.getColor());
    }
}
class Computer{
    private  String CPU;
    private String memory;
    private  String disk;

    public Computer(String CPU, String memory, String disk) {
        this.CPU = CPU;
        this.memory = memory;
        this.disk = disk;
    }

    public String getCPU() {
        return CPU;
    }

    public void setCPU(String CPU) {
        this.CPU = CPU;
    }

    public String getMemory() {
        return memory;
    }

    public void setMemory(String memory) {
        this.memory = memory;
    }

    public String getDisk() {
        return disk;
    }

    public void setDisk(String disk) {
        this.disk = disk;
    }

    public String getDetail(){
        return CPU+" "+memory+" "+disk+" ";
    }
}
class PC extends Computer{
    String brand;
//父类的的构造器完成父类属性的初始化
    //子类构造器完成子类属性的初始化
    public PC(String CPU, String memory, String disk, String brand) {
        super(CPU, memory, disk);
        this.brand = brand;
    }

    public String getBrand() {
        return brand;
    }
}
class NotePad extends Computer{
    private String color;
    public NotePad(String CPU, String memory, String disk,String color) {
        super(CPU, memory, disk);
        this.color = color;
    }

    public String getColor() {
        return color;
    }
}